package com.song.dp.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.song.dp.entity.TbShopType;
import com.song.dp.service.ITbShopTypeService;
import com.song.dp.utils.R;
import com.song.dp.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tonysong
 * @since 2024-08-08
 */
@RestController
@RequestMapping("/shop-type")
@Api(value = "shopType",tags = "店铺类型接口")
public class TbShopTypeController {

    @Resource
    private ITbShopTypeService shopTypeService;
    @GetMapping("/list")
    @ApiOperation(notes = "点评类型列表",value = "list")
    public Result listTypes(){
        //根据sort字段进行排序
       //List<TbShopType> list = this.shopTypeService.list();
//        QueryWrapper<TbShopType> wrapper =new QueryWrapper<>();
//        wrapper.orderByAsc("sort");
//        List<TbShopType> list = this.shopTypeService.list(wrapper);
         return Result.ok(this.shopTypeService.query().orderByAsc("sort").list());
    }
}
